/*---------------------------------------------------------------------*/
/* --- STC MCU Limited ------------------------------------------------*/
/* --- STC 1T Series MCU Demo Programme -------------------------------*/
/* --- Mobile: (86)13922805190 ----------------------------------------*/
/* --- Fax: 86-0513-55012956,55012947,55012969 ------------------------*/
/* --- Tel: 86-0513-55012928,55012929,55012966 ------------------------*/
/* --- Web: www.STCMCU.com --------------------------------------------*/
/* --- Web: www.STCMCUDATA.com  ---------------------------------------*/
/* --- QQ:  800003751 -------------------------------------------------*/
/* ���Ҫ�ڳ�����ʹ�ô˴���,���ڳ�����ע��ʹ����STC�����ϼ�����            */
/*---------------------------------------------------------------------*/

#include	"config.h"
#include	"System_init.h"
#include	"STC8G_H_GPIO.h"
#include 	"STC8G_H_UART.h"
#include    "STC8G_PCA.h"
#include	"STC8G_H_Delay.h"
#include	"STC8xxxx.H"
#include	"led.h"
#include	"mos.h"
#include	"monitor.h"
#include	"control.h"
#include	"param.h"
#include	"calib.h"
#include	"printf_xxx.h"

#define PWM_MIN 255-30
#define PWM_MAX 255-128

//========================================================================
// ����: void	main(void)
// ����: ����������.
// ����: None.
// ����: None.
// �汾: V1.0, 2012-10-22
//========================================================================
void main(void)
{
	SYS_Init();
	COMx_InitDefine comx = {UART_8bit_BRTx, BRT_Timer1, 460800, DISABLE, DISABLE, DISABLE};
	UART_Configuration(UART1, &comx);
	UART1_Polity(Polity_2);
	S1_Int_Enable();
	LED_Init();
	MOS_Init();
	PWM_MOS=PWM_MIN;
	Mon_Init();
	while(1){
		//printf_s("logf_scan start\n");
		logf_scan(2000U, 4000000UL, 125, 225);
	}
}

void UART1_INT(void) __interrupt UART1_VECTOR __using 1
{
	if(TI){
		TI = 0;
		COM1.B_TX_busy = 0;
	}if(RI){  //如果打开了接收，一定要清除标志位，否则会影响程序运行
		RI = 0;
	}
}
